#include "uart_app.h"

uint8_t rx_dat[30];
uint8_t Rx_finsh_flag;
uint8_t dat_num;

void UART_proc(void)
{
    if (Rx_finsh_flag==1)
    {
        if(dat_num==7)
        {
                if ((rx_dat[0] == pass_word_true[0]) && (rx_dat[1] == pass_word_true[1]) && (rx_dat[2] == pass_word_true[2]))
            {
                    for (uint8_t i = 0; i < 3;i++)
                    {
                            pass_word_true[i] = rx_dat[i + 4];
                    }
            }      
        }
        else
        {
                printf("error!");
        }

                    Rx_finsh_flag = 0;
    }

}


void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
        Rx_finsh_flag = 1;
        dat_num = Size;
}